package com.xxb.utils.id;

import com.github.yitter.idgen.YitIdHelper;

import java.util.Base64;

/**
 * @author RenGaoshuai
 * @date 2023/7/26 15:52
 * @description id生成器
 */
public class IdGeneratorUtil {

    /**
     * 混淆位
     */
    private final static String A = "A";

    /**
     * 获取随机id
     * @return id
     */
    public static Long getId() {
        return YitIdHelper.nextId();
    }


    public static String getSessionId() {
        Long id = getId();

        byte[] data = String.valueOf(id).getBytes();

        data = Base64.getDecoder().decode(data);

        return A + new String(data);
    }
}
